package com.gome.gop.common;

import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;


public class WsClinetAuthHandler implements CallbackHandler {
	public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
		for (int i = 0; i < callbacks.length; i++) {
			WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
			System.out.println("identifier: " + pc.getIdentifier());
			// 这里必须设置密码，否则会抛出：java.lang.IllegalArgumentException: pwd == null
			// but a password is needed
//			pc.setPassword("9ce5b5407b12fb2a232b0c8af14dfd28");//SIT
			pc.setPassword("9ce5b5407b12fb2a232b0c8af14dfd28");//UAT
//			pc.setPassword("44444e8f0684dd9a16b5cf075656e9e2");//PRD
		}
	}
}
